using System;
using System.Collections.Generic;
using System.Text;

namespace NBusiness.Data.Validation
{
    public sealed class RequiredRule : ValidationRule
    {
        public RequiredRule(string Field, RequiredRuleArg arg)
            : base(Field, ValidateRequiredRule, arg, "Field was required but not supplied")
        { }

        public static bool ValidateRequiredRule<T>(T value, ValidationRuleArg e)
        {
            return value != null && !value.Equals(default(T));
        }
    }
}
